﻿namespace WPFBPMN.Converters
{
    using System;
    using System.Windows;
    using System.Windows.Data;

    public class BPMNBrushConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            string key = "Brush" + value.ToString().Substring(4);

            return Application.Current.FindResource(key);
        }

        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            throw new Exception("The method or operation is not implemented.");
        }
    }
}
